package com.framework.validated.annotation;

import com.framework.validated.validation.GenderConstraint;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.*;

// 元注解
@Documented
// 运行时可以通过反射获取
@Retention(RetentionPolicy.RUNTIME)
// 允许用在属性字段上
@Target({ElementType.FIELD})
// 校验器,非常容易忘记添加校验器
@Constraint(validatedBy = {GenderConstraint.class})
public @interface Gender {

    String message() default "性别只能是男或女！";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
